import java.util.*;
public class Main {
    public static List<Integer> path = new ArrayList<>();
    public static List<List<Integer>> res = new ArrayList<>();
    public static void backTracking(int[] nums, int startIndex,
                                    boolean[] is_val) {
        if (path.size() >= 2) {
            res.add(new ArrayList<>(path));
        }
        for (int i = startIndex; i < nums.length; i++) {
            if (i > 0 && nums[i] == nums[i - 1] && !is_val[i - 1]) {
                continue;
            }
            path.add(nums[i]);
            is_val[i] = true;
            backTracking(nums, i + 1, is_val);
            path.remove(path.size() - 1);
            is_val[i] = false;
        }
    }
    public static List<List<Integer>> func1(int[] nums) {
        boolean[] is_val = new boolean[nums.length];
        backTracking(nums, 0, is_val);
        return res;
    }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int[] nums = new int[num];

        for (int i = 0; i < nums.length; i++) {
            nums[i] = scan.nextInt();
        }
        Arrays.sort(nums);
        List<List<Integer>> result = func1(nums);
        int count = 0;
        for (List<Integer> lst : result) {
            System.out.println(lst);
            int temp1 = 1;
            int temp2 = 0;
            for (int i = 0; i < lst.size(); i++) {
                temp1 *= lst.get(i);
                temp2 += lst.get(i);
            }
            if (temp1 < temp2) {
                count += 1;
            }
        }
        System.out.println(count);
    }
}